<template>
  <div>
    <CategorySelector :isDisable="showNum !== 0" />
    <SPUList
      v-if="showNum == 0"
      @changeCom="showNum = $event"
      @getSpuInfo="toAddSpuDataInfo = $event"
    />
    <!-- @toAddSkuInfo="toAddSkuInfo" -->
    <addSPU
      v-else-if="showNum == 1"
      @changeCom="showNum = $event"
      :toAddSpuDataInfo="toAddSpuDataInfo"
    />
    <addSku v-else :spuInfo="toAddSpuDataInfo" @changeCom="showNum = $event" />
  </div>
</template>

<script lang="ts">
export default {
  name: 'SPU',
}
// import type { SPUFromDataType2 } from '@/api/product/model/SPUType'
</script>

<script lang="ts" setup>
import CategorySelector from '@/components/CategorySelector/index.vue'
import SPUList from './SPUList/index.vue'
import addSPU from './addSPU/index.vue'
import addSku from '@/components/AddSku/index.vue'

import { ref } from 'vue'

const showNum = ref(0) // 0为列表页   1为编辑页
const toAddSpuDataInfo = ref({
  category3Id: undefined,
  spuName: '',
  tmId: undefined,
  description: '',
  spuSaleAttrList: [],
  spuImageList: [],
})
// const toAddSkuInfo = (row) => {
//   showNum.value = 2
// }
</script>

<style scoped></style>
